import Vue from 'vue'
import VueRouter from 'vue-router'
import Container from "@/views/Container";
import Search from "@/views/Search";
import Pdf from "@/views/Pdf";
import Nav from "@/views/Nav";
import IndexCreate from "@/views/IndexCreate";
import Info from "@/views/Info";
import Tags from "@/views/Tags";

Vue.use(VueRouter)

const routes = [
  {
    path: '/nav',
    name: 'Nav',
    component: Nav
  },
  {
    path: '/container',
    name: 'Container',
    component: Container
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  //  搜索界面
  {
    path: '/search',
    name: 'Search',
    component: Search,
    meta: {
      keepAlive: true
    }
  },
    // 详情界面
  {
    path: '/info',
    name: 'Info',
    component: Info,
  },
  {
    path: '/tags',
    name: 'Tags',
    component: Tags,
  },
  //  索引界面
  {
    path: '/indexCreate',
    name: 'IndexCreate',
    component: IndexCreate,
  },
  //  pdf展示
  {
    path: '/pdf',
    name: 'Pdf',
    component: Pdf
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
